package com.greejoy.score.utils;

import java.util.concurrent.TimeUnit;

import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.WebSocket;
import okhttp3.WebSocketListener;

public class WsUtils {

    public static WebSocket connect(String wsUrl, WebSocketListener webSocketListener){
        OkHttpClient client = new OkHttpClient.Builder()
                .pingInterval(30, TimeUnit.SECONDS)
                .build();
        Request request = new Request.Builder()
                .url(wsUrl)
                .build();
        WebSocket webSocket = client.newWebSocket(request, webSocketListener);
        return webSocket;
    }

}
